home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1997 April / Software of the Month Club 1997 April.iso / pc / dos / dtp / mand / mand.doc next >
Encoding:
Text File  |  1996-11-04  |  9.0 KB  |  159 lines

  1. MAND
  2. Version 1.3
  3. 4 November 1996
  4.  
  5. ------------------------
  6. Gregory Kwok
  7. 142 Armstrong Court
  8. Hercules, CA 94547 USA
  9. <gkwok@california.com>
  10. ------------------------
  11.  
  12. MAND system requirements:
  13.   ■ An 80286 processor, but the faster the better (P6?)
  14.   ■ A VGA graphics adapter that supports 640x480x16 color mode.
  15.   ■ A Microsoft compatible mouse if you want to zoom in or analyze the
  16.     different areas of the fractal, otherwise you cannot view more than
  17.     the initial range.
  18.   ■ A 80x87 or higher math coprocessor is *strongly* recommended. The
  19.     first range takes over an hour to draw on a 386 without one, and about
  20.     25 seconds on my Pentium 133.
  21.  
  22.    This program is dedicated to drawing "the" Mandelbrot fractal set, whose
  23. discovery is generally credited to Benoit Mandelbrot, a French mathematician.
  24. A fractal is a self-similar object or image that retains its complexity and
  25. detail at any level of magnification. A simple fractal is a tree: a branch
  26. can be magnified to resemble the entire tree. A twig on this branch has
  27. small sprouts that resemble the tree, and so on with these sprouts, and
  28. "twiglets" and "sproutlets", all which bear similarity to the original tree.
  29.  
  30.    One well-known fractal is the Koch snowflake curve. First, start with an
  31. equilateral triangle with sides of length k. Now, trisect each side and
  32. remove the middle segment (whose length is k/3). Construct a new equilateral
  33. triangle in place of the missing middle segments each with sides of length
  34. k/3. At this stage the "snowflake" looks more like the Jewish Star of David.
  35.    Now take all these smaller triangles and trisect *their* sides and
  36. construct new equilateral triangles, whose lengths will be k/9. Continue
  37. trisecting the new triangles' sides and constructing new equilateral tri-
  38. angles, and you will end up with the Koch snowflake curve. [using calculus,
  39. one can prove that the area of the entire snowflake is 8/5 of the area of
  40. the original triangle. However, because there are an infinite number of
  41. triangles, the perimeter of the snowflake is infinite!]
  42.  
  43.    Another famous fractal is the Sierpinski triangle, or Sierpinski gasket.
  44. This fractal destroys the original image instead of adding to it. First,
  45. as with the Koch snowflake, draw an equilateral triangle. Bisect each side
  46. and connect the bisecting points to form a new equilateral triangle. (if the
  47. original triangle pointed "up", then this new triangle points "down") Color
  48. in the new triangle.
  49.    There are now three small white equilateral triangles. Bisect their sides
  50. and color in the resulting equilateral triangle. If the colored areas are
  51. considered to be void, while the white areas are considered part of the
  52. gasket, we have two seemingly contradictory facts: (1) the perimeter of the
  53. Sierpinski gasket is infinite, and (2) its area approaches 0 as a limit.
  54.  
  55.    Fractals can also be mathematical images that are described by a formula
  56. rather than words, and the Mandelbrot set is one example. However, before I
  57. delve into the construction of the Mandelbrot set, we must take a brief
  58. review/refresh of the complex numbers. Those of you who are well-versed in
  59. complex numbers can skip the next section.
  60. ===============================================================================
  61.    Most numbers you are familiar with are *real numbers*. These include such
  62. numbers as 0, 97, 2.718, -0.25, π, √2, 1/3. However, consider the quadratic
  63. equation x²+1 = 0. There is no solution unless we set x to √-1, which intro-
  64. duces the complex number set, denoted as "C" (the real set is denoted as "R").
  65. A complex number is the sum of a real number and an imaginary number; it
  66. takes the general form (a + bi), where a and b are real, and i is the square
  67. root of -1. The following are all examples of complex numbers:
  68. (5 + 2i)     (3 + 6i)     (3 + i)     (10 - 7i)     (4 - 39i)
  69. (0 + 12i) = 12i           (21 + 0i) = 21
  70. In the case where a=0, we are left with just 12i, which is called a *pure
  71. imaginary number.* When b=0 as in (21 + 0i) we are left with 21, which is
  72. a real number. Thus, all reals are complex numbers whose b=0.
  73.    You can add, subtract, multiply, divide, and compare complex numbers. A
  74. complex number (a + bi) is equal to (c + di) if and only if a=c and b=d, and
  75. (a + bi) != (c + di) if a!=c or b!=d. You cannot use the inequality operators
  76. <  ≤  >  ≥   with complex numbers. For this discussion, we are primarily
  77. interested in adding and multiplying complex numbers.
  78.    To add two complex numbers (a + bi) and (c + di), you simply combine the
  79. like terms: a and b, and bi and di. (a + bi) + (c + di) = a + bi + c + di =
  80. a + c + bi + di = (a + c) + (b + d)i. Subtraction follows thereafter:
  81. (a + bi) - (c + di) = a + bi - c - di = a - c + bi - di = (a - c) + (b - d)i.
  82.    When multiplying, use the binomial expansion: (a + bi)(c + di) =
  83. ac + adi + bci + bdi². Since (√x)² = x, we can safely say that i² = -1. We
  84. get ac + adi + bci - bd──the i² drops out and changes the sign of its term.
  85. Continuing: ac - bd + adi + bci = (ac - bd) + (ad + bc)i.
  86.    Summary:  (a + bi) + (c + di) = (a + c) + (b + d)i
  87.              (a + bi) - (c + di) = (a - c) + (b - d)i
  88.              (a + bi)(c + di)    = (ac - bd) + (ad + bc)i
  89. ===============================================================================
  90.    The complex numbers can be graphed as points on a Cartesian plane as a
  91. means of representing them. The (x, y) coordinates correspond to a and b
  92. of (a + bi), where a is the real axis and b is the imaginary axis. THIS is
  93. what the Mandelbrot set is all about──quite simple after you examine the
  94. complexity of its results!
  95.    Mandelbrot's formal definition of the Mandelbrot set is
  96.      "All such µ...under z->z²-µ where z[0]=0 that do not converge to ∞."
  97.    What does all this mean? Let me show an example. First, let z, a
  98. complex number, equal 0. Pick any complex number and call it µ. Now set z
  99. to z²-µ (or simply -µ in this case, since 0²=0), following the rules for
  100. complex multiplication and subtraction. Set z to z²-µ, which can be expanded
  101. to µ²-µ. Continue as many times as desired, setting z to z²-µ. One of two
  102. things will happen: z will converge to infinity, that is, its a and b values
  103. will approach infinity; or it will stay relatively small.
  104.    For those such µ when z stays small, they are the elements of the Mandel-
  105. brot set. The µ when z approaches infinity are not. Take a look at the output
  106. of MAND if you wish, or see the graphics file MAND.GIF. The black areas are
  107. the complex numbers on a Cartesian plane that do not converge to infinity.
  108. The blue areas are the µ that converge to infinity rather quickly. The
  109. intermediate colors are chosen based on how quickly they increase in magni-
  110. tude and tend to infinity.
  111.    But this image isn't self-similar! you say. The Mandelbrot contains an
  112. infinite amount of fractals! For instance, the needle-point on the right
  113. has little blobs on it. If you zoom in to the blobs, you will see that they
  114. are in fact miniature replicas of the original image!
  115.    Also, in between the two big curves to the right of the mouse cursor,
  116. the edges of the fractal contain many instances of the original images, only
  117. turned at different angles. Keep trying! You will need about a 32,000X
  118. magnification to see the first ones.
  119.    Use the right mouse button to examine different points on the graph. For
  120. instance, the tip of the needle is µ=2. The center of the large circle to
  121. the right of the mouse is µ=1, and it has a radius of 0.25. The little
  122. indentation at the left of the image is µ=-0.25.
  123. ===============================================================================
  124.    BONUS: Also included with MAND is IFSFERN, written in QBasic. It draws
  125. a fractal "fern" using several complex constants and four simultaneous
  126. equations. No, I didn't write it; I copied out of an old PC Magazine
  127. tutor article about fractal compression (I forgot which issue). I also
  128. forgot what the "IFS" stands for :( , this program was written quite a
  129. while ago. This program runs a lot faster than MAND because it is not
  130. iterative──it doesn't keep calculating z²-µ, it just plugs a complex
  131. number into a normal algebraic function one time and plots its pixel.
  132. ===============================================================================
  133.    MAND was written in Borland Turbo C++ 3.0 for DOS.
  134.    On my Pentium 133, it takes just under 25 seconds to draw the initial
  135. screen. I never realized that this program could be used to test a machine's
  136. computation speed! The computers at school (I am a senior in high school) take
  137. *forever*. Even their 486SX/40 takes over an hour... If you do have a math
  138. coprocessor and want to downgrade yourself and see how slowly MAND would run
  139. with out it, set the environment variable 87 to N by typing SET 87=N at the
  140. command line; there are no spaces around the equals sign.
  141.  
  142.    Well, that's about it! If you need instructions on using MAND, type
  143. MAND /? at the command prompt. Have fun!
  144.  
  145. And now back to your regularly scheduled fourth dimension....
  146.  
  147.  
  148. How's this for a smiley? A fish about to gulp down a worm on a hook:
  149.  
  150.      >===)))°≥  ~√
  151.  
  152.  
  153.  
  154. Bye.
  155.  
  156. +++ATH
  157. OK
  158.  
  159.